package com.xbongbong.parent.field;

import com.xbongbong.paas.constant.PaasConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2021/05/21 14:38
 */
@Configuration
public class FieldAnalyseConfig {



    @Autowired
    private Map<String, FieldAnalyseService> fieldAnalyseMap;

    @Bean("fieldAnalyseMap")
    public Map<Integer, FieldAnalyseService> initFieldAnalyseMapMap() {
        Map<Integer, FieldAnalyseService> fieldMap = new HashMap<>(PaasConstant.DEFAULT_INITIAL_CAPACITY);
        fieldAnalyseMap.forEach((key, item)->{
            item.fieldType().forEach(fieldType->{
                fieldMap.put(fieldType, item);
            });
        });
        return fieldMap;
    }
}
